package com.hq.fxh.No3_TuiGuang.MyMoBan.Activity.item;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hq.fxh.No3_TuiGuang.MyMoBan.Activity.AdBannerInfo;
import com.hq.fxh.R;


/**
 * @author 大圣
 * @ClassName QRCodeAdContentItem
 * @Description : 二维码广告内容
 * @Created 2015/12/22 0022
 * @Email qwqe601660957@163.com
 */
public class QRCodeAdContentItem extends LinearLayout {
    /** 二维码图片 */
    private ImageView ivQRCodePic;
    /** 二维码描述 */
    private TextView tvQRCodeName;
    /** 公众号 */
    private TextView tvWechatID;
//    private AppCompatCheckBox cbPic;
    public QRCodeAdContentItem(Context context) {
        super(context);
        inflate(context, R.layout.item_qrcode_ad_content, this);
        initView();
    }

    private void initView() {
        ivQRCodePic = (ImageView) findViewById(R.id.ivQRCodePic);
        tvQRCodeName = (TextView) findViewById(R.id.tvQRCodeName);
        tvWechatID = (TextView) findViewById(R.id.tvWechatID);
//        cbPic = (AppCompatCheckBox) findViewById(R.id.cbPic);
    }

    /**
     *
     * @param adInfo
     */
    public void showAdInfo(final AdBannerInfo adInfo){
        if(adInfo != null){
            final AdBannerInfo.AdvertDetailBean merchantArticleWechatModel = adInfo.getAdvert_detail();
            if(merchantArticleWechatModel != null){
//                final Pic qrCodePic = merchantArticleWechatModel.getWechatQRCode();
//                if(qrCodePic != null){
//
//                    if(qrCodePic.isNative()){
//                        Bitmap bitmap = ImageUtils.bytes2Bimap(Base64.decode(qrCodePic.getPicData(), Base64.DEFAULT));
//                        ivQRCodePic.setImageBitmap(bitmap);
//                    }else{
//                        IImageLoader.getInstance().load(getContext(),ivQRCodePic,qrCodePic.getPicUrl());
//                    }
//                }
//                GlideUtils.loadRoundedImage(getContext(),merchantArticleWechatModel.getPic(),getContext().getResources().getDimensionPixelSize(R.dimen.size_6),ivQRCodePic);
                tvQRCodeName.setText(merchantArticleWechatModel.getDes());//描述
                tvWechatID.setText(merchantArticleWechatModel.getName());

            }
        }
    }
}
